package com.jyhg.core.common.utils
{
	import starling.filters.ColorMatrixFilter;

	/**
	 * @luxiaolong
	 * 
	 * 创建时间：2013-6-6 下午3:21:19
	 * 
	 */
	
	public class MatrixTools
	{

		private static var filter2a:ColorMatrixFilter;
		public function MatrixTools()
		{
		}
		
		
		static public function ArgbToArray(a:int,r:int,g:int,b:int):Vector.<Number>
		{
			var matrix:Vector.<Number> = new Vector.<Number>();
			matrix = matrix.concat(Vector.<Number>([1, 0, 0, 0, r]));        //red
			matrix = matrix.concat(Vector.<Number>([0, 1, 0, 0, g]));        //green
			matrix = matrix.concat(Vector.<Number>([0, 0, 1, 0, b]));        //blue
			matrix = matrix.concat(Vector.<Number>([0, 0, 0, 1, a]));    //alpha
			return matrix;
		}
		
		
		/**
		 * 变黑的滤镜 
		 * @return 
		 * 
		 */		
		public static function getBlackFilter():ColorMatrixFilter
		{
			if(filter2a==null)
			{
				filter2a = new ColorMatrixFilter();
				filter2a.adjustSaturation(-1); 
			}
			return filter2a;
		}
	}
}